﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BML.Infrastructure;
using BML.Infrastructure.Interface;
using Model.BusinessLogic.PhysicalData;
using Model.Manager;
using Model.Manager.DataBase;
/* ==============================================================================
  * Description：关于积分的实现类
  * By Se7en
  * Creation Time：[2013-10-22 9:22:35]
  * @version 1.0
  * ==============================================================================*/


namespace BML.Infrastructure.Implement
{
    /// <summary>
    ///  树状结构
    /// </summary>
    public class PointTreeOp : BaseMemberOp, IPoint
    {
        #region 状态标识

        /// <summary>
        ///     子节点限制数:无限制
        /// </summary>
        internal Int32 SubNum = OpertorStatusCode.NoLimit;

        /// <summary>
        ///     父节点限制数:1
        /// </summary>
        internal Int32 ParentNodeNum = 1;

        #endregion

        #region 构造对象

        public PointTree NewPointTreeObject(Guid id, String nodeName, Guid parentGuid, Guid userGuid, Int32 point, Int32 status)
        {
            return new PointTree
            {
                Id = id,
                NodeName = nodeName,
                ParentGuid = parentGuid,
                UserGuid = userGuid,
                Point = point,
                Status = status,
            };
        }

        #endregion

        #region 实现类

        public void CreatePointNode(IDbContext dbContext, Guid memberShipGuid)
        {
            var dbOpertor = dbContext.GetOperator<PointTree>();
            Create(dbOpertor, NewPointTreeObject(Guid.NewGuid(), "NodeName", Guid.Empty, memberShipGuid, 1, OpertorStatusCode.Display));
        }

        public void CreateSubPointNode(IDbContext dbContext, Guid parentGuid, Guid memberShipGuid)
        {
            var dbOpertor = dbContext.GetOperator<PointTree>();
            Create(dbOpertor, NewPointTreeObject(Guid.NewGuid(), "NodeName", parentGuid, memberShipGuid, 1, OpertorStatusCode.Display));
        }

        public void ChangePoint()
        {
            throw new NotImplementedException();
        }

        public IList<TEntity> QueryParent<TEntity>()
        {
            throw new NotImplementedException();
        }

        #endregion

    }


}
